<template>
  <teleport to="body">
    <div
      v-if="visible && isMounted"
      class="axiom-bottom-sheet-overlay"
      :class="{ 'is-visible': visible }"
      @click.self="close"
    >
      <div class="axiom-bottom-sheet-container">
        <!-- The content (like the CCard) will be slotted here -->
        <slot></slot>
      </div>
    </div>
  </teleport>
</template>

<script setup>
import { ref, onMounted } from 'vue';

const props = defineProps({
  visible: {
    type: Boolean,
    default: false,
  },
});

const emit = defineEmits(['update:visible']);

const isMounted = ref(false);
onMounted(() => {
  isMounted.value = true;
});

const close = () => {
  emit('update:visible', false);
};
</script>

<style lang="scss">
@use '../../styles/components/mobile/axiom-bottom-sheet';
</style> 